<template>
    <div class="edu-page-warp">
        <el-card shadow="never" body-style="padding: 24px;">
            <div class="edu-page-title" style="margin-bottom: 20px;">批量设置无效</div>
            <div>
                <el-form :model="conditionForm" label-width="130px" ref='effectForm'>
                    <el-form-item :label="$t('graduationList.originalGraduationYear') + ':'" prop='graduationDate'  :rules="[{ required: true, message: '请选择原毕业年份', trigger: ['blur', 'change'] }]">
                        <el-date-picker
                            v-model="conditionForm.graduationDate"
                            value-format="yyyy"
                            align="right"
                            type="year"
                            :placeholder="$t('common.pla.pleaseSelect')"
                            clearable
                            style="width: 250px" />
                            <el-button type="primary" @click="setValidity('effectForm')" style="margin-left: 10px;">设置无效</el-button>
                    </el-form-item>
                </el-form>
            </div>
        </el-card>
    </div>

</template>
<script>
    import {completeBatchValid} from 'common/src/api/graduationManagement/graduationManage'
    export default {
        name: '',
        data() {
            return {
                conditionForm: {
                    graduationDate: ''
                },
                isOverseas: '0'
            }
        },
        methods: {
            setValidity(formName) {
                this.$refs[formName].validate(valid => {
                    if (valid) {
                        let param = {
                            isOverSea: this.isOverseas,
                            grade: this.conditionForm.graduationDate
                        }
                        completeBatchValid(param).then(res =>{
                            if (res && res.code == 200) {
                                this.$message({
                                    type: 'success',
                                    message: '设置成功'
                                })
                            }
                        })
                    }else {
                        return false;
                    }
                });
            }
        },
    }
</script>
<style lang="scss"></style>